package com.dragon.upms.biz.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dragon.common.core.util.R;
import com.dragon.common.feign.annotation.NoToken;
import com.dragon.common.security.annotation.Inner;
import com.dragon.upms.api.entity.SysOauthClientDetails;
import com.dragon.upms.biz.service.SysOauthClientDetailsService;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @date: 2024/8/14 00:13
 * @author: ybl
 */
@RestController
@AllArgsConstructor
@RequestMapping("/client")
//@Tag(description = "client", name = "客户端管理模块")
//@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysClientController {

    private final SysOauthClientDetailsService clientDetailsService;

//    GET /client/getClientDetailsById/test HTTP/1.1

    @Inner
    @GetMapping("/getClientDetailsById/{clientId}")
    public R getClientDetailsById(@PathVariable String clientId) {
        SysOauthClientDetails sysOauthClientDetails = clientDetailsService.getOne(
                Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false);
//        return R.success(clientDetailsService.getOne(
//                Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId),
//                false));
        return R.success(sysOauthClientDetails);
    }

}
